package com.zues.strategy;


/**
 * 支付上下文
 */
public class PaymentContext {

    private PaymentStrategy strategy;

    /**
     * 构造方法
     * @param strategy 支付策略
     */
    public PaymentContext(PaymentStrategy strategy) {
        this.strategy = strategy;
    }

    /**
     * 设置支付策略
     * @param strategy 支付策略
     */
    public void setStrategy(PaymentStrategy strategy) {
        this.strategy = strategy;
    }

    /**
     * 执行支付
     * @param amount 金额
     */
    public void execute(double amount) {
        strategy.pay(amount);
    }


}
